﻿using System;
using System.Configuration;

namespace PS.WSSDeploy.Service
{
    internal class Config
    {

        public static string ServiceHost
        {
            get
            {
                return ConfigurationManager.AppSettings["ServiceHost"];
            }
        }

        public static string ServicePort
        {
            get
            {
                return ConfigurationManager.AppSettings["ServicePort"] ?? "9000";
            }
        }

        public static string MetadataPort
        {
            get
            {
                return ConfigurationManager.AppSettings["MetadataPort"] ?? "9001";
            }
        }

        public static int MaxReceivedMessageSize
        {
            get
            {
                string val = ConfigurationManager.AppSettings["MaxReceivedMessageSize"];
                return (string.IsNullOrEmpty(val)) ? 2147483647 : Convert.ToInt32(val);
            }
        }

        public static int ReaderQuotas_MaxArrayLength
        {
            get
            {
                string val = ConfigurationManager.AppSettings["ReaderQuotas_MaxArrayLength"];
                return (string.IsNullOrEmpty(val)) ? 2147483647 : Convert.ToInt32(val);
            }
        }

        public static string RemoteDebuggerDir
        {
            get
            {
                string path = 
                    ConfigurationManager.AppSettings["RemoteDebuggerDir"] 
                    ?? @"C:\Tools\RemoteDebugger\";

                return path.EndsWith(@"\") ? path : path + @"\";
            }
        }

        public static string ServiceCertificateSerialNumber
        {
            get
            {
                return ConfigurationManager.AppSettings["ServiceCertificateSerialNumber"];
            }
        }

        public static string ClientCertificateSubjectName
        {
            get
            {
                return ConfigurationManager.AppSettings["ClientCertificateSubjectName"];
            }
        }
    }
}
